#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
	int c1, k1, g1, c2, k2, g2, x, i;
	for (i = 0; i < n; i++) {
		scanf("%d %d %d", &c1, &k1, &g1);
		if (c1 > k1) { x = c1; c1 = k1; k1 = x; }
		if (c1 > g1) { x = c1; c1 = g1; g1 = x; }
		if (k1 > g1) { x = k1; k1 = g1; g1 = x; }
		scanf("%d %d %d", &c2, &k2, &g2);
		if (c2 > k2) { x = c2; c2 = k2; k2 = x; }
		if (c2 > g2) { x = c2; c2 = g2; g2 = x; }
		if (k2 > g2) { x = k2; k2 = g2; g2 = x; }
		if ((c1 >= c2 && k1 >= k2 && g1 >= g2) || (c1 < c2 && k1 < k2 && g1 < g2)) {
			printf("yes\n");
		}
		else {
			printf("no\n");
		}
	}
	return 0;
}